import axios from '@/http/axios'

/**
 * 基础接口
 * */

// 查询厂区列表
export const getFactoryList = (data) => {
  return axios({
    prefix: '/actual',
    url: '/tFactory/findPage',
    method: 'post',
    data
  })
}
// 新增或者修改厂区
export const postFactory = (data) => {
  return axios({
    prefix: '/actual',
    url: '/tFactory/save',
    method: 'post',
    data
  })
}
// 获取单个厂房信息
export const getFactoryInfo = (params) => {
  return axios({
    prefix: '/actual',
    url: '/tFactory/findById',
    method: 'get',
    params
  })
}

// 删除厂区
export const postDelFactory = (data) => {
  return axios({
    prefix: '/actual',
    url: '/tFactory/delete',
    method: 'post',
    data
  })
}

// 获取车间列表
export const getWorkShopList = (data) => {
  return axios({
    prefix: '/actual',
    url: '/tWorkshop/findPage',
    method: 'post',
    data
  })
}

// 获取车间信息
export const getWorkShopInfo = (params) => {
  return axios({
    prefix: '/actual',
    url: '/tWorkshop/findById',
    method: 'get',
    params
  })
}
// 添加车间信息
export const postAddWorkShopInfo = (data) => {
  return axios({
    prefix: '/actual',
    url: '/tWorkshop/save',
    method: 'post',
    data
  })
}

// 删除车间
export const postDelWorkShopInfo = (data) => {
  return axios({
    prefix: '/actual',
    url: '/tWorkshop/delete',
    method: 'post',
    data
  })
}

// 获取流水线列表
export const getLineList = (data) => {
  return axios({
    prefix: '/actual',
    url: '/tLine/findPage',
    method: 'post',
    data
  })
}

// 获取流水线信息
export const getLineInfo = (params) => {
  return axios({
    prefix: '/actual',
    url: '/tLine/findById',
    method: 'get',
    params
  })
}
// 添加流水线信息
export const postAddLineInfo = (data) => {
  return axios({
    prefix: '/actual',
    url: '/tLine/save',
    method: 'post',
    data
  })
}

// 删除流水线
export const postDelLine = (data) => {
  return axios({
    prefix: '/actual',
    url: '/tLine/delete',
    method: 'post',
    data
  })
}

// 根据类型查询厂房子项
// type:1.车间 2.流水线 3.工位   id 厂房/车间/流水线id
export const getTypeList = (params) => {
  return axios({
    prefix: '/actual',
    url: '/tFactory/getKids',
    method: 'get',
    params
  })
}

// 查询所有设备操作信息
export const getDeviceOperaction = (data) => {
  return axios({
    prefix: '/actual',
    url: '/tEquipmentOperation/findPage',
    method: 'post',
    data
  })
}

// 查询所有设备异常信息
export const getDeviceError = (data) => {
  return axios({
    prefix: '/actual',
    url: '/tEquipmentOperation/findPage',
    method: 'post',
    data
  })
}
